package com.ceuer.demo.sync;

import java.util.concurrent.CopyOnWriteArrayList;

//测试安全线程集合
public class SafeList1 {
	public static void main(String[] args) {
		CopyOnWriteArrayList<String> list=new CopyOnWriteArrayList<String>();
		for (int i = 0; i < 10000; i++) {
			new Thread(()->{
				list.add(Thread.currentThread().getName());
			}).start();
		}
		System.out.println(list.size());
	}
}
